/**
 * 转移函数返回值的所有权
 */
fn main() {
    let s1 = gives_ownership();
    print!("{}", s1);

    let s2 = String::from(", world");

    let s3 = takes_and_gives_back(s2);
    println!("{}", s3);
}

fn gives_ownership() -> String {
    let some_string = String::from("hello");
    some_string
}

/**
 * 接收a_string的所有权后，又将a_string的所有权返回
 * 就是，通过函数返回值，来转移所有权的概念
 */
fn takes_and_gives_back(a_string: String) -> String { 
    a_string
}